@extends('frontend/layouts/flaty_to_bootstrap')

@section('content.titley')
Parts Management ::
@parent
@stop

@section('content.breadcrumb.inner')
    <li><a href="{{  route('home') }}"><i class="icon-home"></i> Dashboard</a><span class="divider"><i class="icon-angle-right"></i></span></li>
    <li class="active">Parts list</li>
@stop

@section('content.main')

<p>{{ link_to_route('car_balance.parts.create', 'Add new Parts', null, array('class' => 'btn btn-info')) }}</p>

    <!--{{ link_to_route('car_balance.parts.index', 'Include Deleted Parts', array('withTrashed' => 'true'), array('class' => 'btn btn-medium')) }}
    {{ link_to_route('car_balance.parts.index', 'Show Only Deleted Parts', array('onlyTrashed' => 'true'), array('class' => 'btn btn-medium')) }}-->

{{  $partss->links() }}

<table class="table table-bordered table-striped table-hover">
    <thead>
    <tr>
                <th>Id</th>
                <th>Purchase Date</th>
                <th>Parts Name</th>
                <th>Seller</th>
                <th>Seller Send Type</th>
                <th>Recieve Date</th>
                <th>Pickup Car Chassis Number</th>
                <th>Payment Type</th>
                <th>Payment Commission</th>
                <th>Payment Date</th>
                <th>Price</th>
                <th>Delivery Fee</th>
                <th>Commission</th>
                <th>Fee Mongol</th>
                <th>Comment</th>
                <th>Cancel Flag</th>
                        <th>Customer</th>                <th>Car Auction</th>
        <th class="span2">Actions</th>
    </tr>
    </thead>
    <tbody>
    @foreach ($partss as $parts)
    <tr>
        <td>{{  link_to_route('car_balance.parts.show', $parts->id, array($parts->id), array()) }}</td>
        <td>{{  $parts->purchase_date }}</td>
        <td>{{  $parts->parts_name }}</td>
        <td>{{  $parts->seller }}</td>
        <td>{{  $parts->seller_send_type }}</td>
        <td>{{  $parts->recieve_date }}</td>
        <td>{{  $parts->pickup_car_chassis_number }}</td>
        <td>{{  $parts->payment_type }}</td>
        <td>{{  $parts->payment_commission }}</td>
        <td>{{  $parts->payment_date }}</td>
        <td>{{  $parts->price }}</td>
        <td>{{  $parts->delivery_fee }}</td>
        <td>{{  $parts->commission }}</td>
        <td>{{  $parts->fee_mongol }}</td>
        <td>{{  $parts->comment }}</td>
        <td>{{  $parts->cancel_flag }}</td>

        <td>{{  $parts->customer()->first() ? link_to_route('car_balance.customer.show', $parts->customer()->first()->name, array('id' => $parts->customer()->first()->id), array()) : 'NULL' }}</td>
        <td>{{  $parts->carAuction()->first() ? link_to_route('car_balance.car_auction.show', $parts->carAuction()->first()->name, array('id' => $parts->carAuction()->first()->id), array()) : 'NULL' }}</td>

        <td>
            <a href="{{  route('car_balance.parts.edit', $parts->id) }}" class="btn btn-mini">Edit</a>
            @if ( ! is_null($parts->deleted_at))
            <a href="{{  route('car_balance.parts.restore', $parts->id) }}" class="btn btn-mini btn-warning">Restore</a>
            @else
            <a href="{{  route('car_balance.parts.delete', $parts->id) }}" class="btn btn-mini btn-danger">Delete</a>
            @endif
        </td>
    </tr>
    @endforeach
    </tbody>
</table>

{{  $partss->links() }}

@stop